Xbasic

ODBC_IMPORT_TABLE Function

Syntax

C odbc_import_table(C type ,C source_filename_or_dsn ,C table_to_create ,C sql_statement [,C password [,C user_name ]])

Arguments

type

Value
For file type
"ACCESS"

Microsoft Access ".mdb" database.

"EXCEL"

Microsoft Excel ".xls" spreadsheet.

"OUTLOOK"

Microsoft Outlook folder.

source_filename_or_dsn

Full filename and path of the source database.

table_to_create

Full filename and path of the Alpha table to create.

sql_statement

An SQL expression that selects the records used to create the new Alpha table.

password

Where required by the external database: password.

user_name

Where required by the external database: user name.

Description

Imports a table from an external ODBC source, or an Access, Excel, or Outlook file, to a DBF table.

Discussion

ODBC_IMPORT_TABLE() imports a data from an external source and creates an Alpha table. A good way to get sample code is to select File > Import > ODBC Import Genie. Step through the import process. On the last screen, click Show Xbasic. Copy the Xbasic code to your project. Note : The ODBC_IMPORT_TABLE() function requires the installation of < span class=Screen>Microsoft Data Access Components</span>.

Example

odbc_import_table("ACCESS","C:\Samples\Company.mdb","C:\Databases\Functions\Company.dbf","select * from company","","")
odbc_import_table("EXCEL","C:\Samples\Company.xls","C:\Databases\Functions\Books.dbf","select * from sheet1$","","")
odbc_import_table("OUTLOOK","Personal Folders","C:\Databases\Functions\Contacts.dbf","select * from contacts","","")

See Also